#pragma once
#ifndef _WRD_QUEUE__HPP
#define _WRD_QUEUE__HPP

#include <wrdc.h>
#define __WRD__DEBUG 1
#include <wrdbg.h>

#define QUEUE_INIT_SIZE 100
#define QUEUE_INCREMENT 10

#ifndef __QUEUE__ELEM
#include "cstr.h"
#define queue_elem_t cstr_t
#endif  // __QUEUE__ELEM

/* 底层容器结构：List  */

typedef struct queue_s{
    queue_elem_t **base;
    queue_elem_t **front;
    queue_elem_t **back;  // 指向一个空的、待写入元素
    int length;
    int size;
} queue_t;

queue_t queue_init(int size);

queue_t queue();

int queue_len(queue_t s);

void debug_queue(queue_t s);

void queue_push(queue_t *s, queue_elem_t *data);

// 从队列中移除 头指针并返回
queue_elem_t queue_pop(queue_t *s);

queue_elem_t queue_back(queue_t s);

queue_elem_t queue_front(queue_t s);

void queue_free(queue_t *s);

#endif  // _WRD_QUEUE__HPP